package com.fuda.trade.model
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions

class TradeStrategyDataUnitTest {
    @Test
    fun serialize_isCorrect() {
        val shortData = TradeStrategyData.Short(
            volume = 100,
            desc = "Publish1@TradeStrategyDataUnitTest.kt" )

        val payload = TradeStrategyData.serialize(shortData)

        val data = TradeStrategyData.deserialize(payload)

        when (data){
            is TradeStrategyData.Short -> {
                Assertions.assertEquals(data.volume, 100)
            }
            is TradeStrategyData.Long -> {
                Assertions.assertEquals(data.volume, 100)
            }

        }

        println("\n\nserialized= $payload\n")

        Assertions.assertEquals(shortData, data)
    }
}